package net.xinqushi.java8stream;

import java.util.ArrayList;
import java.util.function.Predicate;

/**
 * @author xjie 2019/7/23 10:56
 * @description
 */
public class PredicateTest {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        for(int i = 0 ; i < 10 ; i++){
            list.add(i+ "");
        }
        list.removeIf(new Predicate<String>() {
            public boolean test(String s) {
                return Integer.valueOf(s).equals(1);
            }
        }.or((s)->{
            return Integer.valueOf(s).equals(2);
        }).negate());//只取1，2
        list.forEach(System.out::println);
    }
}
